package com.gufe.controller.user.mp;


import com.gufe.constant.JwtClaimsConstant;
import com.gufe.dto.UserLoginDTO;
import com.gufe.entity.User;
import com.gufe.properties.JwtProperties;
import com.gufe.result.Result;
import com.gufe.service.user.mp.UserService;
import com.gufe.utils.JwtUtil;
import com.gufe.vo.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/user/user")
@Slf4j
@Api(tags = "C端用户相关接口")
public class UserController {


    @Autowired
    private UserService userService;

    @Autowired
    private JwtProperties jwtProperties;

     /*
     *微信登录
     *@param userLoginDTO
     *@return
     * */
    @PostMapping("/login")
    @ApiOperation("登录接口")
    public Result<UserLoginVO> login(@RequestBody UserLoginDTO userLoginDTO){
        //微信登录
        UserLoginVO userLoginVO = userService.wxlogin(userLoginDTO);
        log.info("用户Id为{}已登录",userLoginVO.getUserId());
        return Result.success(userLoginVO);
    }


}
